<template>
  <div class="login_container">
    <div class="login_box">
      <!-- 头像区域 -->
      <div class="avater_box">
        <img src="../assets/logo.png" alt="">
      </div>
      <!-- 注册表单区域 -->
      <el-form :model="login_form" label-width="0px" class="login_form">
        <!-- v-model双向绑定指令 -->
        <!-- 用户名 -->
        <el-form-item :model="login_form">
          <el-input v-model="login_form.username" prefix-icon="iconfont icon-user" placeholder="请输入你的学号"></el-input>
        </el-form-item>
        <!-- 密码 -->
        <el-form-item :model="login_form">
          <el-input type="password" v-model="login_form.password" prefix-icon="iconfont icon-password" placeholder="请输密码"></el-input>
        </el-form-item>
        <!-- 再次输入密码 -->
        <el-form-item>
          <el-input type="password" v-model="login_form.passwordAgain" prefix-icon="iconfont icon-password" placeholder="请输再次输入密码"></el-input>
        </el-form-item>
        <!-- 按钮区 -->
        <el-form-item class="btns">
          <el-button type="primary" @click="update">提交注册</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 这是登陆表单的数据绑定对象
      login_form:{
        username: '',
        password: '',
        passwordAgain: ''
      }
    }
  },
  methods: {
    update() {
      let config = {
          headers: {'Content-Type': 'application/json'}
      }
      let param = {
        user_id:null,
        userName:"3018216310",
        password:"12138",
        status: null,
        roles:null
      }
      this.$axios
      .post('/users',param,config)
      .then(function (response) {
        console.log(response);
      })
      .catch(function (error) {
        console.log(error);
      });
    // window.sessionStorage.clear()
    // this.$router.push('/home')
    },

  },
}
</script>

<style lang="less" scoped>
  .login_container{
    background-color:#F6CECE;
    height: 100%;
  }

  .login_box{
    width: 450px;
    height: 360px;
    background-color: #fff;
    border-radius: 3px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
  }

  .avater_box{
    height: 130px;
    width: 130px;
    // 盒子的边框
    border: 1px solid #eee;
    border-radius: 50%;
    // 图片和边框的内边距
    padding: 10px;
    // 边框线加阴影
    box-shadow: 0 0 10px #ddd;

    // 位置定位
    position: absolute;
    left: 50%;
    transform: translate(-50%,-50%);
    background-color: #fff;

    img {
      width: 100%;
      height: 100%;
      border-radius: 50%;
      background-color: #eee;
    }
  }

  .btns{
    display: flex;
    justify-content: flex-end;
  }

  .login_form{
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
  }
</style>